package com.yihaodian.indices;

import java.util.Collection;

import com.yihaodian.index.IndexShard;
import com.yihaodian.index.meta.IndexMeta;
import com.yihaodian.index.meta.shard.ShardId;
import com.yihaodian.index.meta.shard.ShardRouting;
import com.yihaodian.server.LifeCycleService;

public interface IndicesService extends LifeCycleService {
	/**
	 * create a new index shard
	 * 
	 * @param shard
	 */
	public boolean startIndexShard(IndexMeta meta, ShardRouting shard);

	/**
	 * stop a index shard
	 * 
	 * @param shard
	 */

	public void stopIndexShard(ShardId shard);

	/**
	 * 
	 * get index shard
	 * 
	 * @param shard
	 * @return
	 */
	public IndexShard getIndexShard(ShardId shard);

	/**
	 * 
	 * @param shardId
	 */
	public void enableShard(ShardId shardId);

	/**
	 * 
	 * @param shardId
	 */
	public void disableShard(ShardId shardId);

	/**
	 * all the shards in current node.
	 * 
	 * @return
	 */
	public Collection<ShardRouting> shardRouting();
	
	/**
	 * Get index schema.
	 * 
	 * @param indexId
	 * @return index schema xml in string. 	
	 */
	String getSchemaXml(String indexId);

}
